﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mindfor.Web.Mvc
{
	/// <summary>
	/// Allows to set custom type convertion error message.
	/// DefaultModelBinder must inherrited from <see cref="Mindfor.WebMP.Mvc.DefaultCmsModelBinder"/>.
	/// </summary>
	[AttributeUsage(AttributeTargets.Property, Inherited=true, AllowMultiple=false)]
	public class ConvertErrorAttribute : Attribute
	{
		/// <summary>
		/// Gets or sets custom error message. {0} - field name, {1} - attempted value.
		/// </summary>
		public string ErrorMessage { get; set; }

		/// <summary>
		/// Allows to set custom type convertion error message.
		/// </summary>
		/// <param name="errorMessage">Custom error message. {0} - field name, {1} - attempted value.</param>
		public ConvertErrorAttribute(string errorMessage)
		{
			ErrorMessage = errorMessage;
		}
	}
}
